package com.amesit.utils;

import org.apache.commons.beanutils.Converter;

import com.amesit.bean.privilege.SystemPrivilegePK;

public class SystemPrivilegePKConverter implements Converter {

	public Object convert(Class arg0, Object value) {
		if(value==null || "".equals((String)value)) return null;
		if(value instanceof SystemPrivilegePK) return value;
		try {
			String idstr = (String)value;
			String[] idkey = idstr.split(",");
			if(idkey.length==2){
				return new SystemPrivilegePK(idkey[0], idkey[1]);
			}
		}catch (Exception e) {}
		return null;
	}

}
